import request from '@/utils/http'

export function login (payload) {
  return request({
    url: 'user/login',
    method: 'post',
    data: payload
  })
}

export function getApi (payload) {
  return request({
    url: 'api/findByNUAndM',
    method: 'get',
    params: payload
  })
}

export function addApi (payload) {
  return request({
    url: 'api/insert',
    method: 'post',
    data: payload
  })
}

export function updateApi (_id, payload) {
  return request({
    // url: 'api/' + _id,
    // method: 'patch',
    // data: payload
    url: 'api/update',
    method: 'put',
    data: payload
  })
}

// export function delApi (_id) {
//   return request({
//     url: 'api/' + _id,
//     method: 'delete'
//   })
// }
export function deleteApi (payload) {
  return request({
    url: 'api/delete',
    method: 'delete',
    data: payload
  })
}

export function findTypeApi (payload) {
  return request({
    url: 'api/findByM',
    method: 'get',
    params: payload
  })
}

export function findAllApi () {
  return request({
    url: 'api/findAll',
    method: 'get'
  })
}
